package basic;

public class Pet {
    private String name;
    private int age;
    protected String birthday;


    public void Pet(String name, int age){
        this.name = name;
        this.age = age;
    }
    public String getName(){
        return name;
    }
    public int getAge(){
        return age;
    }
    public String getBirthday(){
        return  birthday;
    }
    public void setBirthday(String birthday){
        this.birthday = birthday;
    }
    public void setName(String name){
        this.name = name;
    }
    public void setAge(int age){
        this.age = age;
    }

    public void eat(){
        System.out.println("在吃东西");
    }

    public void shout(){
        System.out.println("宠物会叫");
    }
//    父类的构造方法既不能被继承，也不能被重写
    public Pet(String name){
        System.out.println("宠物实例被创建了,宠物名字为：" + name);
    }


    public static void main(String[] args) {
//        Pet pet = new Pet();
//        pet.setName("小狗");
//        pet.setAge(3);
//        pet.eat();
//        pet.shout();
//        System.out.println("名字：" + pet.getName());
//        System.out.println("年龄：" + pet.getAge());
//        Dog dog = new Dog("huahua");
//        dog.setName("欢欢");
//        dog.setWeight(30f);
//        System.out.println("====" + dog.getWeight());
//        dog.eat();
//        dog.run();
//        dog.shout();
//        new Dog("花花");
//        Cat cat = new Cat();
//        cat.setName("豆豆");
//        cat.eat();
//        cat.sleep();
//        cat.shout();
//        new Cat("芋头");
//        Cat cat = new Cat();
//        cat.eat();
        }
}
